<template>
  <div>
    <div class="header">
      <p>    
          <img src="../../assets/imgs/信封.png" alt />   
      </p>
      <el-dropdown  trigger="click" @command="handleCommand">
        <span class="header-p">
          <img src="http://iflyssedata.oss-cn-shanghai.aliyuncs.com/images/20200102093243_759118.png?x-oss-process=image/resize,m_fixed,h_100,w_100" alt />
          <p>{{stuName}}</p>
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item command="personalCenter">个人中心</el-dropdown-item>
          <el-dropdown-item command="loginout">退出登录</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
    <div class="header-1">
      <img src="../../assets/imgs/log.png" alt />
      <h2>实验室管理系统格言：立志 诚毅 创新</h2>
    </div>
    <div class="navigation-bar">
      <a></a>
      <div class="ff-content">
        <div class="ff-tab">
          <p class="ff-show" style="color:#1993d1" @click="home">网站首页</p>
        </div>
        <div
          class="ff-tab"
          v-for="(item,index) in navigation"
          :key="index"
          @mouseenter="displayNavigation(index)"
          @mouseleave="displayNavigations(index)"
        >
          <p class="ff-show" style="color:#1993d1">{{item}}</p>
          <i></i>
        </div>
      </div>

      <div class="ff-manys" v-if=" active === 0" @mouseleave="displayNavigations(5)">
        <div class="ff-a-wrap">
          <p>实验中心首页</p>
          <p>实验室申请</p>
          <p>中心概况</p>
        </div>
      </div>
      <div class="ff-manys" v-else-if="active === 1" @mouseleave="displayNavigations(5)">
        <div class="ff-a-wrap">
          <p @click="patentWall">专利墙1</p>
          <p>专利墙2</p>
          <p>专利墙3</p>
        </div>
      </div>
      <div class="ff-manys" v-else-if="active === 2" @mouseleave="displayNavigations(5)">
        <div class="ff-a-wrap">
          <p @click="laboratoryApply">实验室申请</p>
        </div>
      </div>
      <div class="ff-manys" v-else-if="active === 3" @mouseleave="displayNavigations(5)">
        <div class="ff-a-wrap">
          <p>活动中心1</p>
          <p>活动中心2</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import $ from "jquery";

export default {
  data() {
    return {
      navigation: ["实验中心", "专利墙", "实验申请", "活动中心"],
      navigations: [
        ["实验中心首页"],
        ["实验中心首页", "实验室申请", "中心概况"],
        ["专利墙1", "专利墙2", "专利墙3"],
        ["资源共享1", "资源共享2", "资源共享3"],
        ["活动中心1", "活动中心2"],
      ],
      show: "block",
      active: 5,
      stuName:this.$store.state.student.name
    };
  },
  methods: {
    displayNavigation(index) {
      this.active = index;
      $("i:eq(" + index + ")").css({
        "-webkit-transform": "rotate(180deg)",
        transform: "rotate(180deg)",
      });
    },
    displayNavigations(index) {
      this.active = index;
      $("i:eq(" + this.active + ")").css({
        "-webkit-transform": "none",
        transform: "none",
      });
    },
    laboratoryApply() {
      let routerData = this.$router.resolve({
        path: "/laboratoryApply",
      });
      window.open(routerData.href, "_blank");
    },
    home() {
      this.$router.push("/index");
    },
    patentWall(){
      this.$router.push("/patentWall");
    },

    handleCommand(command) {
      if (command == "loginout") {
        localStorage.removeItem("data");
        this.$router.push("/login");
      }else if (command == "personalCenter") {
         this.$router.push("/personalcenter");
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.header {
  width: 100%;
  height: 35px;
  border-bottom: 1px solid #0c0c0c;
  display: flex;
  justify-content: flex-end;
  background-color: #123874;
}

.header p {
  border-left: 1px solid #0c0c0c;
  padding-left: 10px;
  padding-right: 10px;
  font-size: 10px;
  font-family: 微软雅黑;
  margin: 0px;
}
.header p a {
  color: white;
}
.header-p {
  margin-right: 50px;
}
.header img {
  width: 35px;
  height: 30px;
}
.header-p img {
  width: 35px;
  height: 30px;
  border-radius: 50%;
}
.header-1 {
  width: 100%;
  height: 100px;
  background: #143f7a url(../../assets/imgs/school-log.png) 90% -70px no-repeat;
}
.header-1 img {
  width: 300px;
  height: 60px;
  margin: 20px 100px 20px 50px;
  float: left;
}
.header-1 h2 {
  float: right;
  margin: 10px 100px 10px;
  color: white;
}

h3 {
  color: #1e9fff;
  font-family: 幼圆;
  margin-bottom: 10px;
  font-weight: bold;
  font-size: 20px;
}
.navigation-bar {
  height: 40px;
  position: relative;
  background-color: #123874;
}
.ff-content {
  width: 1000px;
  text-align: center;
  margin: 0 auto;
  height: 40px;
}
.ff-tab {
  margin-right: 40px;
  font-size: 14px;
  color: white;
  display: inline-block;
  position: relative;
  width: 56px;
}
.ff-tab a {
  color: white;
}
.ff-show {
  height: 40px;
  line-height: 10px;
  cursor: pointer;
}
.ff-tab i {
  position: absolute;
  top: 31px;
  left: 23px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid white;
  border-bottom: 5px solid transparent;
  transition: all 0.5s;
}
.ff-tab .fx {
  -webkit-transform: rotate(180deg);
  transform: rotate(180deg);
}
.ff-manys {
  height: 60px;
  background: rgba(255, 255, 255, 0.8);
  position: absolute;
  width: 100%;
  top: 40px;
  z-index: 10;
  text-align: center;
  border-top: 2px solid #1993d1;
  color: black;
}

.ff-a-wrap {
  display: inline-block;
}
.ff-a-wrap p {
  float: left;
  margin-right: 50px;
  padding: 10px 0px 7px;
  text-decoration: none;
  font-size: 14px;
  color: #404040;
  cursor: pointer;
}
.ff-a-wrap p:hover {
  color: #1993d1;
}
.head {
  /*position: fixed;*/
  top: 0px;
  background: linear-gradient(rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.9));
}
</style>